home *** CD-ROM | disk | FTP | other *** search
- procedure TForm1.MyGridDrawCell(Sender: TObject; Col, Row: Longint;
- Rect: TRect; State: TGridDrawState);
- var
- TextStr : array[0..255] of Char;
- begin
- {Because DefaultDrawing is set to True, the cell will actually be drawn once,
- so call FillRect to blank it out. This may seem like more work, but in fact
- everything like setting the font, pen and brushes is set this way, so all
- the text drawing is simpler as none of this behaviour needs to be reproduced
- here.}
- MyGrid.Canvas.FillRect(Rect);
- StrPCopy(TextStr,MyGrid.Cells[Col,Row]);
- Rect.Top := Rect.Top + 2; {Adjust for looks}
- DrawText(MyGrid.Canvas.Handle,TextStr,StrLen(TextStr),Rect,
- DT_CENTER or DT_NOPREFIX or DT_WORDBREAK);
- end;
-